package nl.maarten.docenthelp.manager;

import java.util.ArrayList;

import nl.maarten.docenthelp.data.Database;
import nl.maarten.docenthelp.entity.Category;

public class CategoryManager
{
	private static CategoryManager instanceManager;
	
	private Database db;
	
	private ArrayList<Category> categories;
	
	public static CategoryManager getInstance()
	{
		if( instanceManager == null)
		{
			instanceManager = new CategoryManager();
		}
		
		return instanceManager;
	}
	
	private CategoryManager()
	{
		db = Database.getInstance();
		
		categories = new ArrayList<Category>();
		
		refreshCategories();
	}
	
	public ArrayList<Category> getCategories()
	{
		return categories;
	}
	
	public void refreshCategories()
	{
		categories.clear();
		
		categories = db.getCategories();
	}
}
